var RecentCounter = function () {
    this.queue = []
};

/** 
 * @param {number} t
 * @return {number}
 */
RecentCounter.prototype.ping = function (t) {
    this.queue.push(t)
    if (t <= 3000) {
        return this.queue.length
    } else {
        let a = t - 3000
        this.queue = this.queue.filter(item => item >= a)
        return this.queue.length
    }
};